package net.lb.socketserver.handler.impl;

import javax.annotation.Resource;
import net.lb.baseutil.collection.ByteBufferPool;
import net.lb.socketserver.bus.BusinessCommand;
import net.lb.socketserver.bus.Message;
import net.lb.socketserver.handler.MessageHandler;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

@Resource
public class ClearBufferCacheHandler implements MessageHandler
{
    private Logger logger = LogManager.getLogger();
    
    @Override
    public byte interestedDataPacketType()
    {
        return BusinessCommand.CLEAR_BUFFER;
    }
    
    @Override
    public void handler(Message message)
    {
        logger.debug("清除内存缓存");
        ByteBufferPool.clearBufferCache();
        message.getChannelInfo().close();
    }
    
}
